home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).zip
/
Franz PD Disk #334 (1994-06)(Rhein-Sieg-Soft).adf
/
tracker.library
/
Demos
/
Screen.asm
< prev
next >
Wrap
Assembly Source File
|
1994-01-09
|
6KB
|
212 lines
;TestProgramm für "tracker.library"
; Testet TRK_OpenScreen und TRK_CloseScreen
; benutzt TRK_OpenStdLibrary, TRK_Open
NOLIST
INCLUDE "exec/LVO.i"
INCLUDE "exec/memory.i"
INCLUDE "dos/LVO.i"
INCLUDE "dos/dosextens.i"
INCLUDE "intuition/screens.i"
INCLUDE "tracker.i"
LIST
_TrackerBase: EQUR a5
_DosBase: EQUR a4
_IntuitionBase: EQUR a3
Output: EQUR d7
; WB-Message ?
sub.l a1,a1 ;a1=0->eigener Task
CALLEXEC FindTask ;Wo darf man denn nachschauen ?
move.l d0,a0
tst.l pr_CLI(a0) ;von CLI oder WB aus gestartet ?
bne fromCLI
;von WB aus:
lea pr_MsgPort(a0),a0
move.l a0,-(sp)
CALL WaitPort ;auf Start-Message warten
move.l (sp)+,a0
CALL GetMsg ;muß nachher beantwortet werden
move.l d0,WBenchMsg
fromCLI:
; Tracker-Library öffnen
OPENLIB TrName
tst.l d0
beq ende_all
move.l d0,_TrackerBase
TRK_OPENSTDLIB DOS,36
tst.l d0
beq ende_trk
move.l d0,_DosBase
TRK_OPENSTDLIB INTUITION,34
tst.l d0
beq ende_trk
move.l d0,_IntuitionBase
tst.l WBenchMsg
bne fromWB
;von CLI aus -> Ausgaben ins CLI-Fenster
CALLDOS Output
move.l d0,Output
bra main
;von WB aus gestartet -> eigenes Window nötig
fromWB: move.l #WdName,d1
move.l #MODE_OLDFILE,d2
CALLTRK TRK_Open
move.l d0,Output
;---------------------------------------------------------------------------
;Haupt-Testteil
OPENS: MACRO ;Adresse der NewScreen-Struktur, sichern in
lea \1,a0
bsr OpenScreen
IFNC '\2',''
move.l d0,\2
ENDC
ENDM
OPENST: MACRO ;Adresse der NewScreen-Struktur, Start TagList, sichern in
lea \1,a0
lea \2,a1
bsr OpenScreenTags
IFNC '\3',''
move.l d0,\3
ENDC
ENDM
CLOSES: MACRO ;wo gesichert
move.l \1,a0
bsr CloseScreen
ENDM
main: OPENS ns1,d6
OPENST ns5,t5,d5
OPENS ns2
OPENS ns3,d4
OPENST 0,t6,d3
CLOSES d5
OPENST 0,t7
CLOSES d4
OPENS ns4,d5
CLOSES d3
move.l #500,d1
CALL Delay
;---------------------------------------------------------------------------
;ggf. Abschieds-Message
tst.l WBenchMsg
beq ende_trk
move.l Output,d1
move.l #GoodBye,d2
move.l #GoodByeLen,d3 ;jetzt sind die Speicher-Pointer uninteressant
CALLDOS Write
move.l #150,d1
CALL Delay
;Library schließen
ende_trk:
CLOSELIB _TrackerBase
ende_all:
tst.l WBenchMsg ;war da was ?
beq toCLI ;na dann halt nicht
;Message zur WB zurück
move.l WBenchMsg,a1
CALLEXEC ReplyMsg
toCLI: moveq #0,d0
rts
;---------------------------------------------------------------------------
;Unterroutine: TRK_OpenScreenTagList testen
;Parameter: a0 = Adresse einer NewScreen-Struktur
; a1 = Adresse des 1. Tags
;Ergebnis: Adresse des geöffneten Screens / 0 bei Fehler
OpenScreenTags:
movem.l d2/d3,-(sp) ;d2/d3 sichern
CALLTRK TRK_OpenScreenTagList
move.l #OpenTagsText,d2
bra PostOpenScreen
;---------------------------------------------------------------------------
;Unterroutine: TRK_OpenScreen testen
;Parameter: a0 = Adresse einer NewScreen-Struktur
;Ergebnis: Adresse des geöffneten Screens / 0 bei Fehler
OpenScreen:
movem.l d2/d3,-(sp) ;d2/d3 sichern
CALLTRK TRK_OpenScreen
move.l #OpenText,d2
PostOpenScreen:
move.l d0,-(sp) ;d0=2. Ausgabeparameter
move.l #sc_Title,a0
move.l 0(a0,d0.l),-(sp) ;Adresse des Screen-Titles==1. Parameter
move.l Output,d1
move.l sp,d3
CALLDOS VFPrintf
addq.l #4,sp ;1. Parameter löschen
move.l #100,d1
CALL Delay
movem.l (sp)+,d0/d2/d3 ;Ergebnis und d2/d3 holen
rts
;---------------------------------------------------------------------------
;Unterroutine: TRK_CloseScreen testen
;Parameter: a0 = Adresse des Screens
;Ergebnis: -
CloseScreen:
move.l a0,d0
bne 1$
rts
1$: movem.l d2/d3/a0,-(sp) ;Register sichern
CALLTRK TRK_CloseScreen
move.l Output,d1
move.l #CloseText,d2
moveq #8,d3
add.l sp,d3
CALLDOS VFPrintf
move.l #100,d1
CALL Delay
movem.l (sp)+,d2/d3/a0 ;Register zurück
rts
;---------------------------------------------------------------------------
WBenchMsg: dc.l 0
NEWSCR: MACRO ;linker, oberer Rand, Breite, Höhe, Tiefe, ViewModes, Titel
dc.w \1,\2,\3,\4,\5
dc.b 0,1
dc.w \6,CUSTOMSCREEN
dc.l 0,\7,0,0
ENDM
ns1: NEWSCR 0,0,300,50,2,V_LACE,st1
ns2: NEWSCR 150,20,300,30,1,V_HIRES,st2
ns3: NEWSCR 20,40,150,20,6,V_HAM,st3
ns4: NEWSCR 0,100,300,20,2,0,st4
ns5: NEWSCR 10,70,50,20,1,0,st5
t5: dc.l SA_Left,15,SA_Top,55,TAG_END
t6: dc.l SA_Left,320,SA_Top,65,SA_Title,st6
dc.l SA_Width,320,SA_Height,100,TAG_END
t7: dc.l SA_Top,120,SA_Left,200,SA_Width,700,SA_Height,10
dc.l SA_Title,st7,SA_AutoScroll,1,SA_Depth,1,TAG_END
TrName: TRACKERNAME
OpenTagsText: dc.b "Screen ",34,"%s",34," opened with tags, Screen-structure at $%06lx",10,0
OpenText: dc.b "Screen ",34,"%s",34," opened, Screen-structure at $%06lx",10,0
CloseText: dc.b "Screen at $%06lx closed",10,0
WdName: dc.b "CON:////Screen-Test für tracker.library",0
GoodBye: dc.b 10,"Bye - closing soon !"
GoodByeLen: equ *-GoodBye
st1: dc.b "Screen #1",0
st2: dc.b "Screen #2",0
st3: dc.b "Screen #3",0
st4: dc.b "Screen #4",0
st5: dc.b "Screen #5",0
st6: dc.b "Screen #6",0
st7: dc.b "Screen #7",0
END